import 'package:nanoid/nanoid.dart';

class Utils {
  static String truncateWithEllipsis(String text, int maxLength) {
    if (text.length <= maxLength) return text;
    return '${text.substring(0, maxLength)}...';
  }

  static obscurePhoneNumber(String phoneNumber) {
    if (phoneNumber.length < 7) return phoneNumber;
    return phoneNumber.replaceRange(3, 7, '****');
  }

  static String get uuid =>
      customAlphabet('0123456789qwertyuioplkjhgfdsazxcvbnm', 24);
}
